#include<iostream>
#include<string>
#include<cstring>
#include<cerrno>
#include<cstdlib>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include <fcntl.h>

using namespace std;

#define FIFO_FILE "./myfifo"
#define MODE 0664

enum
{
    FIFO_CREAT_ERROR = 1,
    FIFO_DELETE_ERROR,
    FIFO_OPEN_ERROR
};

class PipeInit
{
public:
    PipeInit()
    {
        int n = mkfifo(FIFO_FILE, MODE);
        if(n == -1)
        {
            perror("mkfifo");
            exit(FIFO_CREAT_ERROR);
        }
    }
    ~PipeInit()
    {
        int m = unlink(FIFO_FILE);
        if(m == -1)
        {
            perror("unlink");
            exit(FIFO_DELETE_ERROR);
        }
    }
};